package cn.jingyuan.swan.system.domain.sys.dao.mysql;

import cn.jingyuan.swan.cloud.dao.DaoException;
import cn.jingyuan.swan.cloud.dao.mybatisplus.AbstractMyBatisPlusCrudDao;
import cn.jingyuan.swan.system.domain.sys.dao.AppDao;
import cn.jingyuan.swan.system.domain.sys.entity.App;
import cn.jingyuan.swan.system.domain.sys.mapper.AppMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository
public class AppDaoMySql extends AbstractMyBatisPlusCrudDao<App, String> implements AppDao {

    @Resource
    AppMapper mapper;

    @Override
    public List<App> listByQueryWrapper(LambdaQueryWrapper<App> wrapper) {
        try {
            return mapper.selectList(wrapper);
        } catch (Exception e) {
            throw new DaoException(e);
        }
    }

    @Override
    public BaseMapper<App> getMapper() {
        return this.mapper;
    }

}
